export default {
    state: {
        name: 'lucy'
    },
    mutations: {
        updateName(state, payload) {
            state.name = payload
        }
    },
    getters: {
        fullname(state) {
            return state.name + '11111'
        },
        fullname2(state, getters) {
            return getters.fullname + '22222222'
        },
        // 在模块里getters可以有三个参数，rootsate是根模块
        fullname3(state, getters, rootstate) {
            return getters.fullname2 + rootstate.counter
        }
    },
    actions: {
        aUpdateName(context) {
            setTimeout(() => {
                context.commit('updateName', 'wangwu')
            }, 1000);
        }
    }
}
